<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    for (let a = 1; a <= 5; a++) {
      if (a === 4) {
        break //跳出整个for循环
      }
      console.log(a)
      document.write(a + '<br>')
    }

    console.log('---')
    document.write('---<br>')

    for (let a = 1; a <= 5; a++) {
      if (a === 4) {
        continue //退出本次循环下面不执行，又跳回上面for循环那里a++
      }
      console.log(a)
      document.write(a + '<br>')
    }

    /* //无限循环（死循环）
    for(;;) {
      console.log(11)
    } */
  </script>
</body>

</html>